<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id
 * @property int $room_number 房间编码
 * @property int $mi_seq 麦位 0-1号麦位1-2号麦位以此类推
 * @property int $mi_seq_lock 0-正常；1-锁定
 * @property int $mi_up_down 用户是否在麦位：0-否；1-是
 * @property int $uid 用户id
 * @property string $music
 * @property int $invite_uid 邀请人id
 * @property int $invite_time 邀请时间
 * @property int $u_voice_status 麦克风语音  1-正常； 0-自己关麦
 * @property int $boss_status 是否老板位 0-否；1-是
 * @property int $a_voice_status 麦克风语音  1-正常； 0-被管理员关麦
 */
class ChatRoomMicrophone extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'tb_chat_room_microphone';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = [];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'room_id' => 'integer', 'mi_seq' => 'integer', 'mi_seq_lock' => 'integer', 'mi_up_down' => 'integer', 'uid' => 'integer', 'invite_uid' => 'integer', 'invite_time' => 'integer', 'u_voice_status' => 'integer', 'boss_status' => 'integer', 'a_voice_status' => 'integer'];

    public function userInfo()
    {
        return $this->hasOne(User::class, 'id', 'uid')->select(['id', 'nickname', 'head_image', 'sex', 'age', 'noble', 'wealth']);
    }
}
